<template>
  <div>
    <!--<bread-crumb :one="'系统管理'" :two="'菜单导航'"></bread-crumb>-->

    <el-form :inline="true" :model="formData">
      <el-form-item>
        <el-input v-model="formData.name" placeholder="输入机构名称或者拼音首字母"></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="search" @click="handleSearch()">搜索</el-button>
      </el-form-item>
    </el-form>

    <datagrid :config="dataGrid">
      <div class="toolbar" slot="toolbar">
        <el-button type="primary" @click="handleRefresh()">刷新</el-button>
        <el-button type="primary" @click="handleAddRow()">新增</el-button>
        <el-button type="primary" @click="handleEditRow()">编辑</el-button>
        <el-button type="primary" @click="handleDelete(false)">删除</el-button>
        <el-button type="primary" @click="handleSaveAll()">保存</el-button>
        <el-button type="primary" @click="handleReject()">撤销</el-button>
      </div>
    </datagrid>
  </div>
</template>

<script>
//  import BreadCrumb from "@/components/BreadCrumb.vue";
  import Datagrid from "@/components/EasyuiDatagrid.vue";
  import {easyui} from "@/core";
  import utils from "@/utils";

  export default {
    components: {
//      BreadCrumb,
      Datagrid
    },
    mixins: [easyui],
    data () {
      return {
      	API: {
      		query: "/privilege/menus",
          del: "/gafe/del_server",
          saveAll: "/gafe/saveAll"
        },
        formData: {
          name: ""
        },
        toolbar: [

        ],
        dataGrid: {
      		id: "#editDataGrid",
          edit: true,
          url: "./static/datagrid_data1.json",
          fitColumns: true,
          pagination: true,
          columns: [[
            {field: "itemid", title: "Item ID", align: "center", halign: "center", width: 100},
            {field: "productid", title: "Product", align: "center", halign: "center", width: 100,
              formatter:function(value, row) {
                return row.productname;
              },
              editor:{
              type:'combobox',
              options:{
                valueField:'productid',
                textField:'productname',
                method:'get',
                url:'./static/products.json',
                required:true
              }
            }},
            {field: "listprice", title: "List Price", align: "center",editor: {type:"numberbox", options: {precision: 1}}},
            {field: "unitcost", title: "Unit Cost", align: "center", width: 150, editor: "numberbox"},
            {field: "date", title: "date", align: "center", width: 150, editor: {type: "datebox", options: {editable: false}}},
            {field: "status", title: "Status", align: "center", width: 150, editor: {type:"checkbox", options: {on: "P", off:""}}}
          ]]
        }
      }
    }
  }
</script>

<style scoped>
  .toolbar {
    margin-bottom: 20px;
  }
</style>
